package com.liyuhan.onlinetaxibackground.Controller;

import com.liyuhan.onlinetaxibackground.Service.CompletedOrderService;
import com.liyuhan.onlinetaxibackground.dto.DataResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/completedOrder")
public class CompletedOrderController {
    @Autowired
    private CompletedOrderService completedOrderService;

    @RequestMapping("/getCompletedOrder")
    public DataResponse getCompletedOrder(@Valid @RequestBody String request) {
        return completedOrderService.getCompletedOrder(request);
    }

    @RequestMapping("/payOrder")
    public void payOrder(@Valid @RequestBody String request) {
        completedOrderService.payOrder(request);
    }

    @RequestMapping("/deleteOrder")
    public void deleteOrder(@Valid @RequestBody String request) {
        completedOrderService.deleteOrder(request);
    }

    @RequestMapping("/getOrderState")
    public DataResponse getOrderState(@Valid @RequestBody String request) {
        // 根据订单id订单状态
        return completedOrderService.getOrderState(request);
    }
}
